home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 29 / PC Gamer IT CD 29 2-2.iso / patch / ie4patch / ie4patnt.exe / RCDATA / CABINET / mshtml.dll / HTML / INSIMAGE.DLG < prev    next >
Text File  |  1997-10-16  |  12KB  |  362 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
  2. <HTML id=dlgImage STYLE="font-family: ms sans serif; font-size: 8pt;
  3. width: 40.1em; height: 18em">
  4. <HEAD>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <TITLE>
  7. Picture
  8. </TITLE>
  9. <SCRIPT defer>
  10. function callHelp(elm)
  11. {
  12. if (null != elm.helpid)
  13. {
  14.  window.showHelp(elm.helpfile, "" + parseInt(elm.helpid),
  15.   "popup");
  16. }
  17. else
  18. {
  19.  if ("BODY" != elm.tagName)
  20.  {
  21.   callHelp(elm.parentElement);
  22.  }
  23. }
  24. function btnCancelClick()
  25. {
  26. window.close();
  27. function getTextRange(elm)
  28. {
  29. var r = elm.parentTextEdit.createTextRange();
  30. r.moveToElementText(elm);
  31. return r;
  32. function mouseClick()
  33. {
  34. if (window.event.srcElement.id.substring(0,3)
  35.  == "txt")
  36. {
  37.  return;
  38. }
  39. if (window.event.button == 2)
  40. {
  41.  callHelp(window.event.srcElement);
  42. }
  43. function txtDefaultESC()
  44. {
  45. if (event.keyCode == 27)
  46. {
  47.  window.close();
  48.  return;
  49. }
  50. window.onerror = HandleError
  51. function HandleError(message, url, line)
  52. {
  53. var L_Dialog_ErrorMessage = "An error has occured in this dialog.";
  54. var L_ErrorNumber_Text = "Error: ";
  55. var str = L_Dialog_ErrorMessage + "\n\n" 
  56.  + L_ErrorNumber_Text + line + "\n"
  57.  + message;
  58. alert (str);
  59. window.close();
  60. return true;
  61. }
  62. function setOKState(fKeyPress) { var htmlKeyAlt = 18; if (!fKeyPress || htmlKeyAlt != event.keyCode) { if (("" == txtFileName.value) == g_fOKEnabled) { btnOK.disabled = g_fOKEnabled; g_fOKEnabled = !g_fOKEnabled; } } else { window.setTimeout("set" + "OK" + "State(false)", 50); } }
  63. var g_fOKEnabled = false; 
  64. function btnBrowseClick()
  65. {
  66. var L_Picture_DIALOG_Title_DialogTitle = "Picture";
  67. var L_Picture_DIALOG_FileTypes_Text = "GIF and JPEG (*.gif, *.jpg)|*.gif;*.jpg|Bitmap (*.bmp)|*.bmp|Windows Metafile (*.wmf)|*.wmf|XBM (*.xbm)|*.xbm|ART (*.art)|*.art|All files (*.*)|*.*|";
  68. var strFileName;
  69. strFileName = window.dialogArguments.openfiledlg("","",
  70.  L_Picture_DIALOG_FileTypes_Text,L_Picture_DIALOG_Title_DialogTitle);
  71. if ("" != strFileName)
  72. {
  73.  txtFileName.value = strFileName;
  74. }
  75. setOKState(false);
  76. function getProtocolFromURL(strURL)
  77. {
  78. var index;
  79. return strURL.substring(0, strURL.indexOf(":") + 1);
  80. function bdyLoad()
  81. {
  82. var elmSelectedImage;  
  83. var htmlSelectionControl = "Control";
  84. var globalDoc = window.dialogArguments.document;
  85. var grngMaster = globalDoc.selection.createRange();
  86. txtFileName.onfocus = new Function("txtFileName.select()");
  87. txtFileName.onkeypress = new Function("txtDefaultESC()");
  88. txtAltText.onfocus = new Function("txtAltText.select()");
  89. txtAltText.onkeypress = new Function("txtDefaultESC()");
  90. txtHorizontal.onfocus = new Function("txtHorizontal.select()");
  91. txtHorizontal.onkeypress = new Function("txtDefaultESC()");
  92. txtBorder.onfocus = new Function("txtBorder.select()");
  93. txtBorder.onkeypress = new Function("txtDefaultESC()");
  94. txtVertical.onfocus = new Function("txtVertical.select()");
  95. txtVertical.onkeypress = new Function("txtDefaultESC()");
  96. btnBrowse.onclick = new Function("btnBrowseClick()");
  97. btnOK.onclick = new Function("btnOKClick()");
  98. btnCancel.onclick = new Function("btnCancelClick()");
  99. document.onhelp  = new Function("callHelp(window.event.srcElement)");
  100. document.onmouseup = new Function("mouseClick()");
  101. txtFileName.onkeyup = new Function("setOKState(true)");
  102. txtFileName.fImageLoaded = false; 
  103. txtFileName.intImageWidth = 0; 
  104. txtFileName.intImageHeight = 0; 
  105. if (globalDoc.selection.type == htmlSelectionControl)  
  106. {
  107.  if (grngMaster.length == 1) 
  108.  {
  109.   elmSelectedImage = grngMaster.item(0);
  110.   if (elmSelectedImage.tagName == "IMG") 
  111.   {
  112.    txtFileName.fImageLoaded = true;
  113.    txtFileName.value = elmSelectedImage.src;
  114.    txtFileName.intImageHeight = elmSelectedImage.height;
  115.    txtFileName.intImageWidth = elmSelectedImage.width;
  116.    txtVertical.value = elmSelectedImage.vspace;
  117.    txtHorizontal.value = elmSelectedImage.hspace;
  118.    txtBorder.value = elmSelectedImage.border;
  119.    txtAltText.value = elmSelectedImage.alt;
  120.    selAlignment.value = elmSelectedImage.align;
  121.   }
  122.  }
  123. }
  124. setOKState(false);
  125. txtFileName.focus();
  126. function testTextValue(txtBox)
  127. {
  128. var val = parseInt(txtBox.value);
  129. if (isNaN(val) || val < 0 || val > 999)
  130. {
  131.  return false;
  132. }
  133. return true;
  134. function btnOKClick()
  135. {
  136. var elmImage;  
  137. var intAlignment; 
  138. var L_HorizontalNotNumber_ErrorMessage
  139.  = "Horizontal spacing must be a number between 0 and 999.";
  140. var L_VerticalNotNumber_ErrorMessage
  141.  = "Vertical spacing must be a number between 0 and 999.";
  142. var L_BoderNotNumber_ErrorMessage
  143.  = "Border thickness must be a number between 0 and 999.";
  144. var cmdInsertImage = "InsertImage";
  145. var cmdDelete = "Delete";
  146. var htmlSelectionControl = "Control";
  147. var globalDoc = window.dialogArguments.document;
  148. var grngMaster = globalDoc.selection.createRange();
  149. if ("" != txtHorizontal.value)
  150. {
  151.  if (!testTextValue(txtHorizontal))
  152.   {
  153.    alert(L_HorizontalNotNumber_ErrorMessage);
  154.    txtHorizontal.focus();
  155.    return;
  156.   }
  157. }
  158. if ("" != txtBorder.value)
  159. {
  160.  if (!testTextValue(txtBorder))
  161.   {
  162.    alert(L_BoderNotNumber_ErrorMessage);
  163.    txtBorder.focus();
  164.    return;
  165.   }
  166. }
  167. if ("" != txtVertical.value)
  168. {
  169.  if (!testTextValue(txtVertical))
  170.   {
  171.    alert(L_VerticalNotNumber_ErrorMessage);
  172.    txtVertical.focus();
  173.    return;
  174.   }
  175. }
  176. if (globalDoc.selection.type == htmlSelectionControl
  177.  && !txtFileName.fImageLoaded)
  178. {
  179.  grngMaster.execCommand(cmdDelete);
  180.  grngMaster = globalDoc.selection.createRange();
  181. }
  182. if (!txtFileName.fImageLoaded)
  183. {
  184.  grngMaster.execCommand(cmdInsertImage);
  185.  grngMaster.moveStart("character", -1);
  186.  elmImage = grngMaster.parentElement();
  187. }
  188. else 
  189. {
  190.  elmImage = grngMaster.item(0);
  191.  if (elmImage.src != txtFileName.value)
  192.  {
  193.   grngMaster.execCommand(cmdDelete);
  194.   grngMaster = globalDoc.selection.createRange();
  195.   grngMaster.execCommand(cmdInsertImage);
  196.   grngMaster.moveStart("character", -1);
  197.   elmImage = grngMaster.parentElement();
  198.   txtFileName.fImageLoaded = false;
  199.  }
  200.  grngMaster = getTextRange(elmImage);
  201. }
  202. if (txtFileName.fImageLoaded)
  203. {
  204.  elmImage.style.width = txtFileName.intImageWidth;
  205.  elmImage.style.height = txtFileName.intImageHeight;
  206. }
  207. if ("" == getProtocolFromURL(txtFileName.value))
  208. {
  209.  elmImage.src = "file://" + txtFileName.value;
  210. }
  211. else
  212. {
  213.  elmImage.src = txtFileName.value;
  214. }
  215. if (txtHorizontal.value != "")
  216. {
  217.  elmImage.hspace = parseInt(txtHorizontal.value);
  218. }
  219. else
  220. {
  221.  elmImage.hspace = 0;
  222. }
  223. if (txtVertical.value != "")
  224. {
  225.  elmImage.vspace = parseInt(txtVertical.value);
  226. }
  227. else
  228. {
  229.  elmImage.vspace = 0;
  230. }
  231. elmImage.alt = txtAltText.value;
  232. if (txtBorder.value != "")
  233. {
  234.  elmImage.border = parseInt(txtBorder.value);
  235. }
  236. else
  237. {
  238.  elmImage.border = 0;
  239. }
  240. elmImage.align = selAlignment.value;
  241. grngMaster.collapse(false); 
  242. grngMaster.select();
  243. window.close();
  244. </SCRIPT>
  245. </HEAD>
  246. <BODY onload="bdyLoad()" style="font-family: ms sans serif; font-size: 8pt;
  247. background: threedface;">
  248. <DIV id=divFileName style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  249. left: 0.98em; top: 1.2168em; width: 7em; height: 1.2168em; ">
  250. <LABEL FOR=txtFileName tabIndex=-1
  251. helpid="35450" helpfile="msimn.hlp">
  252. <U>P</U>icture Source:
  253. </LABEL>
  254. </DIV>
  255. <INPUT ID=txtFileName type=text style="font-family: ms sans serif; font-size: 8pt;
  256. position: absolute; left: 8.54em; top: 1.0647em; width: 13.58em;
  257. height: 2.1294em; " helpid="35450" helpfile="msimn.hlp"
  258. tabIndex=10 ACCESSKEY=p>
  259. <DIV id=divAltText style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  260. left: 0.98em; top: 4.1067em; width: 6.58em; height: 1.2168em; ">
  261. <LABEL FOR=txtAltText tabIndex=-1
  262. helpid="35455" helpfile="msimn.hlp">
  263. Alternate <u>T</u>ext:
  264. </LABEL>
  265. </DIV>
  266. <INPUT type=text ID=txtAltText tabIndex=15 ACCESSKEY=t
  267. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  268. left: 8.54em; top: 3.8025em; width: 21.5em; height: 2.1294em; "
  269. helpid="35455" helpfile="msimn.hlp">
  270. <BUTTON ID=btnBrowse style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  271. left: 22.96em; top: 1.0647em; width: 7em; height: 2.2em; "
  272. ACCESSKEY=r tabIndex=12 helpid="35462" helpfile="msimn.hlp">
  273. B<U>r</U>owse...
  274. </BUTTON>
  275. <FIELDSET id=fldLayout style="font-family: ms sans serif; font-size: 8pt; 
  276. position: absolute; left: .9em; top: 7.1em; width: 17.08em; 
  277. height: 7.6em;">
  278. <LEGEND>
  279. Layout
  280. </LEGEND>
  281. </FIELDSET>
  282. <FIELDSET id=fldSpacing style="font-family: ms sans serif; font-size: 8pt; 
  283. position: absolute; left: 18.9em; top: 7.1em; width: 11em; 
  284. height: 7.6em;">
  285. <LEGEND>
  286. Spacing
  287. </LEGEND>
  288. </FIELDSET>
  289. <DIV id=divAlign style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  290. left: 1.82em; top: 9.126em; width: 4.76em; height: 1.2168em; ">
  291. <LABEL FOR=selAlignment tabIndex=-1 helpid="35465" helpfile="msimn.hlp">
  292. <U>A</U>lignment:
  293. </LABEL>
  294. </DIV>
  295. <SELECT size=1 ID=selAlignment tabIndex=20 ACCESSKEY=a
  296. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  297. left: 10.36em; top: 8.8218em; width: 6.72em; height: 1.2168em; "
  298. helpid="35465" helpfile="msimn.hlp">
  299. <OPTION value="">    Not set </OPTION>
  300. <OPTION value=left>    Left  </OPTION>
  301. <OPTION value=right>    Right  </OPTION>
  302. <OPTION value=textTop>   Texttop </OPTION>
  303. <OPTION value=absMiddle>   Absmiddle </OPTION>
  304. <OPTION value=baseline SELECTED> Baseline </OPTION>
  305. <OPTION value=absBottom>   Absbottom </OPTION>
  306. <OPTION value=bottom>   Bottom  </OPTION>
  307. <OPTION value=middle>   Middle  </OPTION>
  308. <OPTION value=top>    Top  </OPTION>
  309. </SELECT>
  310. <DIV id=divHoriz style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  311. left: 19.88em; top: 9.126em; width: 4.76em; height: 1.2168em; ">
  312. <LABEL FOR=txtHorizontal tabIndex=-1 helpid="35475" helpfile="msimn.hlp">
  313. <U>H</U>orizontal:
  314. </LABEL>
  315. </DIV>
  316. <INPUT ID=txtHorizontal style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  317. left: 24.92em; top: 8.8218em; width: 4.2em; height: 2.1294em; "
  318. type=text size=3 value="" tabIndex=25 ACCESSKEY=h
  319. helpid="35475" helpfile="msimn.hlp">
  320. <DIV id=divBorder style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  321. left: 1.82em; top: 12.0159em; width: 8.12em; height: 1.2168em; ">
  322. <LABEL tabIndex=-1 FOR=txtBorder helpid="35470" helpfile="msimn.hlp">
  323. <u>B</u>order Thickness:
  324. </LABEL>
  325. </DIV>
  326. <INPUT ID=txtBorder style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  327. left: 10.36em; top: 11.5596em; width: 6.72em; height: 2.1294em; "
  328. type=text size=3 value="" tabIndex=21 ACCESSKEY=b
  329. helpid="35470" helpfile="msimn.hlp">
  330. <DIV id=divVert style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  331. left: 19.88em; top: 12.0159em; width: 3.64em; height: 1.2168em; ">
  332. <LABEL FOR=txtVertical tabIndex=-1 helpid="35480" helpfile="msimn.hlp">
  333. <U>V</U>ertical:
  334. </LABEL>
  335. </DIV>
  336. <INPUT ID=txtVertical style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  337. left: 24.92em; top: 11.5596em; width: 4.2em; height: 2.1294em; "
  338. type=text size=3 value="" tabIndex=30 ACCESSKEY=v
  339. helpid="35480" helpfile="msimn.hlp">
  340. <BUTTON ID=btnOK style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  341. left: 31.36em; top: 1.0647em; width: 7em; height: 2.2em; " type=submit
  342. tabIndex=40 DISABLED=1 helpid="28443" helpfile="windows.hlp">
  343. OK
  344. </BUTTON>
  345. <BUTTON ID=btnCancel style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  346. left: 31.36em; top: 3.6504em; width: 7em; height: 2.2em; " type=reset
  347. tabIndex=45 helpid="28444" helpfile="windows.hlp">
  348. Cancel
  349. </BUTTON>
  350. </BODY>
  351. </HTML>
  352.